package com.xuan.model.respons;

import lombok.Data;

import java.io.Serializable;

/**
 * 响应结果
 */
@Data
public class ResultBody<T> implements Serializable {


    private Integer code;

    private String message;

    private T data;

    public ResultBody<T> OK(){
        this.code = 100;
        this.message = "响应成功";
        return this;
    }
    public ResultBody<T> OK(String message){
        this.code = 100;
        this.message = message;
        return this;
    }


    public ResultBody Fail(){
        this.code = 0;
        this.message = "执行失败";
        return this;
    }

    public ResultBody Fail(String message){
        this.code = 0;
        this.message = message;
        return this;
    }

    public ResultBody data(T data){
        this.data = data;
        return this;
    }
}
